package com.huabo.system.oracle.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.system.oracle.entity.TblMonitorSolutionresult;

import java.math.BigDecimal;

public class TblMonitorSolutionresultMapperSqlConfig {


    public String findBySoultionIdZKZX(String zt, String table, BigDecimal soultionId, String rulid, PageInfo<TblMonitorSolutionresult> pageInfo) {
        StringBuffer sbSql = new StringBuffer("SELECT * FROM ( SELECT BUDGET.*,ROWNUM RNUM FROM ( select *  from '"+zt+"'.'"+table+"' where  EXECTIME = (SELECT SIGNID FROM TBL_MONITOR_PREWARNING WHERE SOLUTIONRESULTID = ( select SOLUTIONRESULTID from ( SELECT SOLUTIONRESULTID FROM TBL_MONITOR_SOLUTIONRESULT  WHERE SOURCE = 3 AND SOLUTIONID = '"+soultionId+"' order by savetime desc) where rownum=1) and RULEID= '"+rulid+"') ");
 

        sbSql.append(" ) BUDGET WHERE rownum <= "+(pageInfo.getCurrentPage()*pageInfo.getPageSize())+" ) WHERE RNUM > "+pageInfo.getCurrentRecord());
        String sql = sbSql.toString();
        return sql;
    }

}
